package com.smartleanx.module.hrm.framework.operate.core.enums;

import com.smartleanx.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 员工日志类型枚举
 *
 * @author Marc
 * @since 1.0.0
 */
@Getter
@AllArgsConstructor
public enum DocTypeEnum implements IntArrayValuable {

    EMPLOYEE(1, "员工"),
    PAYROLL(2, "薪资"),
    ;

    private final Integer value;
    private final String description;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DocTypeEnum::getValue).toArray();

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public static DocTypeEnum getByValue(int value) {
        for (DocTypeEnum docTypeEnum : values()) {
            if (docTypeEnum.getValue() == value) {
                return docTypeEnum;
            }
        }
        throw new IllegalArgumentException("Invalid value: " + value);
    }

}

